﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VIFON.DAL;

namespace VIFON.BLL
{
    class BLBill
    {
        static DABill daBill = new DABill();
        static DABillDetail daBillDetail = new DABillDetail();

        /// <summary>
        /// Delete Customer in Bill and Bill Detail by customer id
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        internal List<Bill> GetBillList()
        {
            return daBill.GetBillsList();
        }
        internal bool Delete(int id)
        {
            //Delete bill detail
            List<Bill> lstBill = daBill.GetBills(id);
            if (lstBill != null)
            {
                foreach (var l in lstBill)
                {
                    daBillDetail.Delete(l.Id);
                }
            }
            return daBill.Delete(id);
        }
        internal bool Insert(Bill boBill)
        {        
            return daBill.Insert(boBill);
        }
        internal bool Update(Bill boBill)
        {
            return daBill.Update(boBill);
        }
    }
}
